package what.basic.table;
import javax.swing.*;
import java.awt.*;
import javax.swing.event.*;
import java.awt.event.*;
import javax.swing.table.*;
import what.basic.basiccomponent.*;
public class Jtabletooltiptext {
Jtabletooltiptext(){
	
	Jframe jf=new Jframe();
	JFrame f=jf.jframe("table test",300,300,true);
	Object[][] st={
			{"wangpeng",new Integer(91),new Integer(100)}
			,{"zhuxuelian",new Integer(82),new Integer(69)},
			{"meiting",new Integer(47),new Integer(57)},
	};
	String[] names={"name","yuwen","shuxue"};
	JTable table=new JTable();

	table.setPreferredScrollableViewportSize(new Dimension(550,30));
	table.setModel(new DefaultTableModel(st,names){
		public boolean isCellEditable(int rowIndex,int columnIndex){
			if(columnIndex==0)
				return false;
			return true;
		}
	});
	DefaultTableCellRenderer rd=new DefaultTableCellRenderer();
	rd.setToolTipText("this is important data");
	TableColumnModel cld=table.getColumnModel();
	for(int i=0;i<names.length;i++){
		TableColumn tc=cld.getColumn(i);
		tc.setCellRenderer(rd);
	}
	JScrollPane sp=new JScrollPane(table);
	f.getContentPane().add(sp,BorderLayout.CENTER);
	f.setTitle("table test window");
	f.pack();
}
public static void main(String[] args) {
	new Jtabletooltiptext();
	}

}
